$import("com.joypard.platform.log.smslog.SmsLogDI");
$import("com.joypard.platform.log.smslog.SmsLogField");

K.defView("com.joypard.platform.log.smslog.SmsLogView", {
	render : function() {
		this.logSearchPanel = this.createLogSearchPanel();
		this.logGridPanel = this.createLogGridPanel();

		this.MP = new K.Ext.MainPanel({
			items : [this.logSearchPanel, this.logGridPanel]
		});

		this.logGridPanel.getStore().load();
	},

	createLogSearchPanel : function() {
		var options = {
			title : "条件查询",
			region : "north",
			margins : "2 2 2 2",
			frame : true,
			iconCls : "p-search",
			collapsible : true,
			bodyCssCls : "search-gb",
			contentEl : "smsLog-search"
		};
		var me = this;

		$("#smsLog-search").keypress(function(evt) {
			var tagName = evt.target.tagName;
			if (tagName == "INPUT" && evt.keyCode == Ext.EventObject.ENTER) {
				me.onSearchLog();
			}
		});
		return new K.Ext.Panel(options);
	},

	createLogGridPanel : function() {
		var options = {
			region : "center",
			title : "短信日志列表",
			store : new K.Ext.data.JsonStore({
				url : SmsLogDI.urls.getSmsLogs,
				root : "parameters.smsLogs",
				fields : SmsLogField.fields
			}),
			columns : [new Ext.grid.RowNumberer(), {
				header : "发送人编码",
				dataIndex : "senderCode"
			}, {
				header : "发送人姓名",
				dataIndex : "senderName"
			}, {
				header : "接受手机",
				dataIndex : "recMobiles"
			}, {
				header : "短信内容",
				dataIndex : "content"
			}]
		};
		return new K.Ext.grid.GridPanel(options);
	}
});